<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="csrf-token" content="{{ csrf_token() }}">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>@yield('title')</title>
        <link rel="stylesheet" href="/houtai/layui/css/layui.css">
        <link rel="stylesheet" href="/houtai/bootstrap-3.3.7/css/bootstrap.min.css">
        @section('head')
            <style>
                #main {
                    width: calc(100% - 0px);
                    height: calc(100% - 51px);
                    background-color: #f2f2f2;
                    padding: 1em;
                    float: right;
                    OVERFLOW: auto;
                }
            </style>
        @show
    </head>
    <body> 
        @section('content')

        @show
    </body>

    <script type="text/javascript" src='/houtai/layui/jquery-3.2.1.js' type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" src='/houtai/layui/layui.js' type="text/javascript" charset="utf-8"></script>

    {{--<script src="{{asset ('/doc/mx_admin_2.6.9')}}/js/jquery-1.11.3.min.js" type="text/javascript" charset="utf-8"></script>--}}
    {{--<script src="{{asset ('/doc/mx_admin_2.6.9')}}/js/layui/layui.js" type="text/javascript" charset="utf-8"></script>--}}
    <!-- 日期插件 -->
    <link type="text/css" rel="stylesheet" href="/riqidate/skin/jedate.css">
    <script type="text/javascript" src="/riqidate/jquery.jedate.min.js"></script>
    <!-- ckeditor.js -->
    <script src="/houtai/ckeditor/ckeditor.js"></script>
    <script type="text/javascript" >
        $("#test11").jeDate({
            format: "YYYY-MM-DD",
            maxDate:$.nowDate({DD:"+0"}),//统计到当日
            multiPane:false,
            range:"~"
        });

        function ajax(url,obj={},func=function(data){
            layer.close();
            layer.closeAll();
            layer.msg(data.msg);
            if(data.code == 1){
                reload();
            }
        }) {
            $.ajax({
                url: url,
                type: "POST",
                data: obj,
                dataType: 'json',
                headers: {
                  'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                },
                success: func,
                error: function(){
                    layer.msg("系统正忙");
                }
            })
        }

        layui.use([ 'element', 'layer','form' ], function(){
            layer = layui.layer;
            form = layui.form;

            //跳转页
            jump = function(url){
                location.href = url;
            }

            //弹窗页面
            active = function(url,id='',title='提示框',width='800px',height='auto'){
                $.ajax({
                    url: url,
                    type: "POST",
                    data: {id:id},
                    dataType: 'html',
                    headers: {
                      'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                    },
                    success: function(arr){
                        // console.log(arr);
                        arrJson = isJson(arr);
                        if(arrJson){
                            layer.msg(arrJson);
                            return false;
                        }else{
                            layer.open({
                                title: title,
                                type: 1,
                                area: [width, height],
                                fixed: true,
                                content: arr,
                                skin: '',
                                // skin: 'layui-layer-lan',
                                // skin: 'layui-layer-molv',
                                maxmin: true,
                                offset: 'auto',
                                resizing:function(layro){
                                    let h = layro.height();
                                    layro.find('.layui-layer-content').css('height',h-42+'px');
                                }
                            });
                        }
                    },
                    error: function(){
                        layer.msg("系统正忙");
                    }
                })
            }

            //删除
            del = function(url,ids){
                layer.confirm('确定(删除)执行此操作？', {
                    icon: 3,
                    title:'提示框',
                    btn: ['确定','取消'] //按钮
                },function(){
                    //确定
                    ajax(url,{id:ids},function(data){
                        layer.close();
                        layer.closeAll();
                        layer.msg(data.msg);
                        if(data.code == 1){
                            // location.href = location.href;
                            reload();
                        }
                    });
                });
            }

        })

        //是否是json格式字符串
        function isJson(arr){
            try{
                var obj = $.parseJSON(arr);
                if(obj.code == 0){
                    return obj.msg;
                }else{
                    return false;
                }
            }catch(e){
                return false;
            }
        }

        //延迟执行 刷新页面
        function reload(){
            setTimeout(function(){
                location.reload();// 这个方法是刷新当前页面
            },1000);
        }
    </script>
    @section('js')

    @show
</html>
